#include <stdio.h>

/*
while       循环
do while    循环

for         循环

goto        循环 (禁用)

*/

int main(int argc, char const *argv[])
{
    int id = 10;
    int pass = 10;

    int read_id = 0;
    int read_pass = 0;

    

#if 0
    int i = 3; // 循环次数

    while (i--)
    {
        printf("请输入账号 密码");
        scanf("%d %d" , &read_id , &read_pass);

        if ((read_id == id) && (read_pass == pass))
        {
            printf("登录成功\n");
            return 1;
        }
        
        else
        {
            printf("登录失败\n");
        }
    }
#endif

#if 0
    int i = 3; // 循环次数
    do
    {
        i--;
        printf("请输入账号 密码");
        scanf("%d %d", &read_id, &read_pass);

        if ((read_id == id) && (read_pass == pass))
        {
            printf("登录成功\n");
            return 1;
        }

        else
        {
            printf("登录失败\n");
        }
    } while (i);

#endif

#if 1
    for (size_t i = 0; i < 3; i++)
    {
        printf("请输入账号 密码");
        scanf("%d %d", &read_id, &read_pass);

        if ((read_id == id) && (read_pass == pass))
        {
            printf("登录成功\n");
            return 1;
        }

        else
        {
            printf("登录失败\n");
        }
    }

#endif
    return 0;
}
